public class Tourist {
    String name;
    int age;

    public int getPrice() {
        if (age <= 14 || age >= 60)
            return 0;
        return 20;
    }
}
//游客那题：一个景区根据游人的年龄收取不同价格的门票。
// 请编写游人类，根据年龄段决定能够购买的门票价格并输出
public class Oppzy01 {
    public static void main(String[] args) {
        while (true) {
            Tourist t = new Tourist();
            Scanner in = new Scanner(System.in);
            System.out.println("Please input name:");
            t.name = in.next();
            if (t.name.equals("n")) {
                System.out.println("Exit!");
                return;
            }
            System.out.println("Please input age:");
            t.age = in.nextInt();
            while (t.age < 0 || t.age > 100) {
                System.out.println("Error!");
                t.age = in.nextInt();
            }
            int price = t.getPrice();
            System.out.println("This tourist's name:" + t.name + "\nage:" + t.age + "\nprice:" + price);
        }
    }
}